package com.piece.mall.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@NoArgsConstructor
@Table(name = "pms_spu_info")
@ApiModel(value = "商品spu属性")
public class PmsSpuInfo implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", length = 11)
    @ApiModelProperty(value = "主键")
    private Long id;

    @Column(name = "spu_name")
    @ApiModelProperty(value = "商品名称")
    private String spuName;

    @Column(name = "spu_description")
    @ApiModelProperty(value = "商品描述")
    private String spuDescription;

    @Column(name = "catalog_id")
    @ApiModelProperty(value = "所属分类主键")
    private Long catalogId;

    @Transient
    @ApiModelProperty(value = "所属分类名称")
    private String catalogName;

    @Column(name = "brand_id")
    @ApiModelProperty(value = "品牌主键")
    private Long brandId;

    @Transient
    @ApiModelProperty(value = "品牌名称")
    private String brandName;

    @Column(name = "publish_status")
    @ApiModelProperty(value = "上架状态", notes = "0=上架, 1=下架")
    private String publishStatus;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;
}
